\hypertarget{_u_s_a_r_t_8h}{\section{C\-:/\-Users/\-Stefan/\-Documents/\-Atmel Studio/\-Robotik\-Seminar/\-R\-R\-T/include/\-U\-S\-A\-R\-T.h File Reference}
\label{_u_s_a_r_t_8h}\index{C\-:/\-Users/\-Stefan/\-Documents/\-Atmel Studio/\-Robotik\-Seminar/\-R\-R\-T/include/\-U\-S\-A\-R\-T.\-h@{C\-:/\-Users/\-Stefan/\-Documents/\-Atmel Studio/\-Robotik\-Seminar/\-R\-R\-T/include/\-U\-S\-A\-R\-T.\-h}}
}
{\ttfamily \#include $<$avr/io.\-h$>$}\\*
{\ttfamily \#include \char`\"{}Utilities.\-h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}error.\-h\char`\"{}}\\*
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structmsg___u_s_a_r_t__t}{msg\-\_\-\-U\-S\-A\-R\-T\-\_\-t}
\end{DoxyCompactItemize}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\hypertarget{_u_s_a_r_t_8h_a9d3f0beef953108963142b557774f885}{\#define {\bfseries F\-\_\-\-C\-P\-U2}~20000000}\label{_u_s_a_r_t_8h_a9d3f0beef953108963142b557774f885}

\item 
\hypertarget{_u_s_a_r_t_8h_a734bbab06e1a9fd2e5522db0221ff6e3}{\#define {\bfseries B\-A\-U\-D\-R\-A\-T\-E}~1200}\label{_u_s_a_r_t_8h_a734bbab06e1a9fd2e5522db0221ff6e3}

\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{_u_s_a_r_t_8h_ab2b795ba261b113b8113d1fd52459132}{msg\-\_\-type\-\_\-\-U\-S\-A\-R\-T\-\_\-t} \{ {\bfseries A\-C\-K}, 
{\bfseries S\-Y\-N\-C}, 
{\bfseries D\-A\-T\-A}
 \}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{_u_s_a_r_t_8h_ab94fbb73b86fff26278a1372bea9833c}{init\-\_\-\-U\-S\-A\-R\-T} ()
\item 
void \hyperlink{_u_s_a_r_t_8h_a4b13c81c6030a58c6c2d0ead00025957}{send\-\_\-byte\-\_\-\-U\-S\-A\-R\-T} (uint8\-\_\-t $\ast$byte)
\item 
void \hyperlink{_u_s_a_r_t_8h_a320cb46f566a2d93e969881fc547f6bb}{send\-\_\-msg\-\_\-\-U\-S\-A\-R\-T} (\hyperlink{structmsg___u_s_a_r_t__t}{msg\-\_\-\-U\-S\-A\-R\-T\-\_\-t} $\ast$msg)
\item 
uint8\-\_\-t \hyperlink{_u_s_a_r_t_8h_a50bb4ca20536062f3522b21d0b73a305}{receive\-\_\-byte\-\_\-\-U\-S\-A\-R\-T} (uint8\-\_\-t $\ast$byte)
\item 
uint8\-\_\-t \hyperlink{_u_s_a_r_t_8h_a9f79410be8cd0f4ddabc71ffd35c86f1}{receive\-\_\-msg\-\_\-\-U\-S\-A\-R\-T} (\hyperlink{structmsg___u_s_a_r_t__t}{msg\-\_\-\-U\-S\-A\-R\-T\-\_\-t} $\ast$msg)
\end{DoxyCompactItemize}


\subsection{Enumeration Type Documentation}
\hypertarget{_u_s_a_r_t_8h_ab2b795ba261b113b8113d1fd52459132}{\index{U\-S\-A\-R\-T.\-h@{U\-S\-A\-R\-T.\-h}!msg\-\_\-type\-\_\-\-U\-S\-A\-R\-T\-\_\-t@{msg\-\_\-type\-\_\-\-U\-S\-A\-R\-T\-\_\-t}}
\index{msg\-\_\-type\-\_\-\-U\-S\-A\-R\-T\-\_\-t@{msg\-\_\-type\-\_\-\-U\-S\-A\-R\-T\-\_\-t}!USART.h@{U\-S\-A\-R\-T.\-h}}
\subsubsection[{msg\-\_\-type\-\_\-\-U\-S\-A\-R\-T\-\_\-t}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf msg\-\_\-type\-\_\-\-U\-S\-A\-R\-T\-\_\-t}}}\label{_u_s_a_r_t_8h_ab2b795ba261b113b8113d1fd52459132}
This enum is representing the different message types, which are used by the protocol for communicating by U\-S\-A\-R\-T 

\subsection{Function Documentation}
\hypertarget{_u_s_a_r_t_8h_ab94fbb73b86fff26278a1372bea9833c}{\index{U\-S\-A\-R\-T.\-h@{U\-S\-A\-R\-T.\-h}!init\-\_\-\-U\-S\-A\-R\-T@{init\-\_\-\-U\-S\-A\-R\-T}}
\index{init\-\_\-\-U\-S\-A\-R\-T@{init\-\_\-\-U\-S\-A\-R\-T}!USART.h@{U\-S\-A\-R\-T.\-h}}
\subsubsection[{init\-\_\-\-U\-S\-A\-R\-T}]{\setlength{\rightskip}{0pt plus 5cm}void init\-\_\-\-U\-S\-A\-R\-T (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{_u_s_a_r_t_8h_ab94fbb73b86fff26278a1372bea9833c}
Initializes the U\-S\-A\-R\-T controller for future use. The frame format defined for U\-S\-A\-R\-T communication consists of eight data bits, a parity bit (even) and two stop bits \hypertarget{_u_s_a_r_t_8h_a50bb4ca20536062f3522b21d0b73a305}{\index{U\-S\-A\-R\-T.\-h@{U\-S\-A\-R\-T.\-h}!receive\-\_\-byte\-\_\-\-U\-S\-A\-R\-T@{receive\-\_\-byte\-\_\-\-U\-S\-A\-R\-T}}
\index{receive\-\_\-byte\-\_\-\-U\-S\-A\-R\-T@{receive\-\_\-byte\-\_\-\-U\-S\-A\-R\-T}!USART.h@{U\-S\-A\-R\-T.\-h}}
\subsubsection[{receive\-\_\-byte\-\_\-\-U\-S\-A\-R\-T}]{\setlength{\rightskip}{0pt plus 5cm}uint8\-\_\-t receive\-\_\-byte\-\_\-\-U\-S\-A\-R\-T (
\begin{DoxyParamCaption}
\item[{uint8\-\_\-t $\ast$}]{byte}
\end{DoxyParamCaption}
)}}\label{_u_s_a_r_t_8h_a50bb4ca20536062f3522b21d0b73a305}
This function blocks until a byte can be received from the U\-S\-A\-R\-T controller \begin{DoxyReturn}{Returns}
Returns 0 at success. Otherwise errno will be set to one of these values\-: \par
 F\-R\-A\-M\-E\-\_\-\-E\-R\-R\-O\-R\-\_\-\-U\-S\-A\-R\-T if a frame error occurred; \par
 P\-A\-R\-I\-T\-Y\-\_\-\-E\-R\-R\-O\-R\-\_\-\-U\-S\-A\-R\-T if a parity error occurred; \par
 O\-V\-E\-R\-F\-L\-O\-W\-\_\-\-U\-S\-A\-R\-T if an overflow occurred 
\end{DoxyReturn}
\hypertarget{_u_s_a_r_t_8h_a9f79410be8cd0f4ddabc71ffd35c86f1}{\index{U\-S\-A\-R\-T.\-h@{U\-S\-A\-R\-T.\-h}!receive\-\_\-msg\-\_\-\-U\-S\-A\-R\-T@{receive\-\_\-msg\-\_\-\-U\-S\-A\-R\-T}}
\index{receive\-\_\-msg\-\_\-\-U\-S\-A\-R\-T@{receive\-\_\-msg\-\_\-\-U\-S\-A\-R\-T}!USART.h@{U\-S\-A\-R\-T.\-h}}
\subsubsection[{receive\-\_\-msg\-\_\-\-U\-S\-A\-R\-T}]{\setlength{\rightskip}{0pt plus 5cm}uint8\-\_\-t receive\-\_\-msg\-\_\-\-U\-S\-A\-R\-T (
\begin{DoxyParamCaption}
\item[{{\bf msg\-\_\-\-U\-S\-A\-R\-T\-\_\-t} $\ast$}]{msg}
\end{DoxyParamCaption}
)}}\label{_u_s_a_r_t_8h_a9f79410be8cd0f4ddabc71ffd35c86f1}
The user is responsible to free the memory of the data field of the returned message. \begin{DoxyReturn}{Returns}
Returns 0 at success. Otherwise errno will be set to one of these values\-:\par
 F\-R\-A\-M\-E\-\_\-\-E\-R\-R\-O\-R\-\_\-\-U\-S\-A\-R\-T if a frame error occurred; \par
 P\-A\-R\-I\-T\-Y\-\_\-\-E\-R\-R\-O\-R\-\_\-\-U\-S\-A\-R\-T if a parity error occurred; \par
 O\-V\-E\-R\-F\-L\-O\-W\-\_\-\-U\-S\-A\-R\-T if an overflow occurred 
\end{DoxyReturn}
\hypertarget{_u_s_a_r_t_8h_a4b13c81c6030a58c6c2d0ead00025957}{\index{U\-S\-A\-R\-T.\-h@{U\-S\-A\-R\-T.\-h}!send\-\_\-byte\-\_\-\-U\-S\-A\-R\-T@{send\-\_\-byte\-\_\-\-U\-S\-A\-R\-T}}
\index{send\-\_\-byte\-\_\-\-U\-S\-A\-R\-T@{send\-\_\-byte\-\_\-\-U\-S\-A\-R\-T}!USART.h@{U\-S\-A\-R\-T.\-h}}
\subsubsection[{send\-\_\-byte\-\_\-\-U\-S\-A\-R\-T}]{\setlength{\rightskip}{0pt plus 5cm}void send\-\_\-byte\-\_\-\-U\-S\-A\-R\-T (
\begin{DoxyParamCaption}
\item[{uint8\-\_\-t $\ast$}]{byte}
\end{DoxyParamCaption}
)}}\label{_u_s_a_r_t_8h_a4b13c81c6030a58c6c2d0ead00025957}
Transmits a single byte by using U\-S\-A\-R\-T \hypertarget{_u_s_a_r_t_8h_a320cb46f566a2d93e969881fc547f6bb}{\index{U\-S\-A\-R\-T.\-h@{U\-S\-A\-R\-T.\-h}!send\-\_\-msg\-\_\-\-U\-S\-A\-R\-T@{send\-\_\-msg\-\_\-\-U\-S\-A\-R\-T}}
\index{send\-\_\-msg\-\_\-\-U\-S\-A\-R\-T@{send\-\_\-msg\-\_\-\-U\-S\-A\-R\-T}!USART.h@{U\-S\-A\-R\-T.\-h}}
\subsubsection[{send\-\_\-msg\-\_\-\-U\-S\-A\-R\-T}]{\setlength{\rightskip}{0pt plus 5cm}void send\-\_\-msg\-\_\-\-U\-S\-A\-R\-T (
\begin{DoxyParamCaption}
\item[{{\bf msg\-\_\-\-U\-S\-A\-R\-T\-\_\-t} $\ast$}]{msg}
\end{DoxyParamCaption}
)}}\label{_u_s_a_r_t_8h_a320cb46f566a2d93e969881fc547f6bb}
Transmits the given message by using U\-S\-A\-R\-T 